import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/home/HomeView.vue'

const routes = [
  { // :pathMatch(.*)*
    path: '/',
    name: 'home',
    meta: {
      isTabbar: true
    },
    component: HomeView
  },
  { // :pathMatch(.*)*
    path: '/location',
    name: 'location',
    component: () => import('../views/home/location/location.vue')
  },
  {
    path: '/topic',
    name: 'topic',
    meta: {
      isTabbar: true
    },
    component: () => import('../views/topic/TopicView.vue')
  },
  {
    path: '/topicDetail/:id',
    name: 'topicDetail',
    component: () => import('../views/topic/topicDetail')
  },
  {
    path: '/category',
    name: 'category',
    meta: {
      isTabbar: true
    },
    component: () => import('../views/category/CategoryView.vue')
  },
  {
    path: '/secCategory/:id',
    name: 'secCategory',
    component: () => import('../views/category/secCategory/secCategory.vue')
  },
  {
    path: '/categoryDetail/:id',
    name: 'categoryDetail',
    component: () => import('../views/category/categoryDetail/categoryDetail.vue')
  },
  {
    path: '/cart',
    name: 'cart',
    meta: {
      isTabbar: true
    },
    component: () => import('../views/cart/CartView.vue')
  },
  {
    path: '/pay',
    name: 'pay',
    component: () => import('../views/cart/pay/index.vue')
  },
  {
    path: '/cart/addressPage',
    name: 'addressPage',
    component: () => import('@/views/cart/addressPage/AddressPage.vue')
  },
  {
    path: '/cart/editaddressPage',
    name: 'editAddress',
    component: () => import('@/views/cart/addressPage/editAddress.vue')
  },
  {
    path: '/mine',
    name: 'mine',
    meta: {
      isTabbar: true
    },
    component: () => import('../views/mine/MineView.vue')
  },
  {
    path: '/mine/collection',
    name: 'collection',
    component: () => import('@/views/mine/collection/collection.vue')
  },
  {
    path: '/mine/submitAction',
    name: 'submitAction',
    component: () => import('@/views/mine/submitAction/submitAction.vue')
  },
  {
    path: '/brand',
    name: 'brand',
    component: () => import('../views/home/brand/index.vue')
  },
  {
    path: '/brandDetail/:id',
    name: 'brandDetail',
    component: () => import('../views/home/brand/brandDetail')
  },
  {
    path: '/goods/:val',
    name: 'goods',
    component: () => import('../views/home/goodsList/index.vue')
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('../views/home/search/index.vue')
  }

  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  // }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
